home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
nask15.zip
/
NASK.DOC
next >
Wrap
Text File
|
1991-06-17
|
4KB
|
100 lines
N-ASK Batch Util (c) 1990 -1-
___ __ ___ ________ __ ___
| \ | | / _ \ / ______| | | / /
| \ | | __ / / \ \ ( (_____ | |/ /
| |\ \| | |__| | |___| | \_____ \ | <
| | \ | | ___ | ______) ) | |\ \
|__| \___| |__| |__| |________/ |__| \__\
Ver 1.5
This is an interactive question asking program used in BATCH files. It
is used in the form of:
NASK "<question>",<possible responses> [-B] [-S]
[-D=<default answer>] [-?] [-A]
The question is any string of characters (including quotes inside the
delimeters). The possible responses are all the letters/numbers that may be
used to respond to the question. These are non-case senstive so you may put
them either in upper or lower case. The -B option makes the program beep when
a response is entered that is not in the possible answers. The -S option will
keep the cursor on the same line as the prompted question. The -D, for default
answer, will return the letter put after the equal sign when you hit enter at
the prompted question. The short help is availiable with the -? or when N-ASK
is run without any parameters. The -A function will return the ascii value of
the key pressed for the errorlevel. This will be demonstrated later.
You can use NASK to write batch menus such as:
ECHO OFF
ECHO [A] MYPROG.EXE
ECHO [B] BLAH.BAT
ECHO [C] WHATEVER.COM
ECHO [D] QUIT
ECHO"
NASK "Which one do you want? ",ABCD -s -b -d=A
if errorlevel 4 goto DONE
if errorlevel 3 goto THIRD
if errorlevel 2 goto SECOND
if errorlevel 1 goto FIRST
:FIRST
MYPROG.EXE
GOTO DONE
:SECOND
CALL BLAH.BAT
GOTO DONE
:THIRD
WHATEVER.COM
GOTO DONE
:DONE
This batch file will echo the availiable options and wait for the user
press one of the keys (A,B,C or D), will stay on the same line as the question
and then will beep if they hit any other's besides those three keys. If they
hit return, it will use "A" as the answer because it was set to the default.
Then NASK will exit with an exit code relative to the position of the letter
in the choices string. Remember, in a batch process, errorlevel x means an
exit code of x or HIGHER! You must do the IF ERRORLEVEL in decending order
to sort out the errorlevels.
N-ASK Batch Util (c) 1990 -2-
Another way to use this program is like this:
NASK "Press a Key:" -A
This will print the "Press a Key" message and wait for any key to be
pressed. Then instead of the errorlevel returned being the position of the
answer in the list you gave before, the errorlevel value is now set to the
ascii value of the key pressed. In the case of a Function key, things are a
little different. Lets say for instance that you pressed the F7 key. The
computer returns a character 0 then a 65. BUT, 65 is the same as a capital
letter "A" so you have to watch out for these things.
Notes:
o You may put multiple commands after a single dash like this:
NASK "What is your answer: ",123 -bsd=1
This program is ShareWare which means you may freely copy and distribute
this program. If you like this program and use it often, you should support
the ShareWare concept by sending $5 (make checks and money orders payable
to "Sean Wachob") to:
Sean Wachob
4226 Colombo Dr.
San Jose, CA 95130-1111
Comments or suggestions may be sent to this same address and the same for a
catalogue of other of my releases. Thank you for using NASK and please look
for my future programs.....